package com.cuoyi.coupon.mall.config;

import com.cuoyi.coupon.mall.model.dto.UserDTO;

/**
 * @author chengzhang
 * 2021/11/15 18:11
 */
public class SessionLocal {

    private static final ThreadLocal<UserDTO> threadLocal = new ThreadLocal<>();

    public static void setUser(UserDTO user) {
        threadLocal.set(user);
    }

    public static UserDTO getUser() {
        return threadLocal.get();
    }

    public static void remove() {
        threadLocal.remove();
    }

}
